﻿@model IEnumerable<CommentNew>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>
<div class="panel panel-body">
    <div class="btn-group">
        @foreach (var t in Enum.GetValues(typeof(CommentEntity)))
        {
            @Html.ActionLink(@t.ToString(), "Index", new { @type = t.ToString() }, new { @class = "btn btn-default" })
        }

        @Html.ActionLink("Alle", "Index", null, new { @class = "btn btn-default" })

    </div>
</div>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.TimeStamp)
        </th>
        <th>
            Titel
        </th>
        <th>
            Kommentar
        </th>

        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.TimeStamp)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                <abbr title="@item.DisplayName">@item.Initials</abbr> skrev:
                @if (item.Value.Length > 50)
                {
                    @item.Value.Substring(0, 30)
                    @Html.Raw("..")
                }
                else
                {
                    @item.Value
                }
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Details", "Details", new { id = item.Id }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.Id })
            </td>
        </tr>
    }

</table>
